﻿$(document).ready(function () {
	var data = getCategorys();
	alert(data);
	draw(data);

});

var getCategorys = function () {
	var data = {};
	$.ajax({
		url : "/green/category/list",
		global : false,
		type : "GET",
		data : "{}",
		dataType : "json",
		async : false,
		success : function (msg) {
			data = msg;
		}
	});
	return data;
}

var draw = function (data) {
	$.each(data, function (idx, item) {
		if (item.Level == 1) {
			var li = "<li><span>" + item.Name + "</span></li>";
			$('#tree').append(li);
		}
	});
}

//取得树分几级
var getMinLevel = function (data) {
	var a = 1;
	$.each(data, function (idx, item) {
		//alert("Idx:" + idx + ",Name:" + item.Name + ",Level:" + item.Level + ",Fid:" + item.Fid);
		if (item.Level > a) {
			a = item.Level
		}
	});
	return a;
}
/**
$(document).ready(function () {
$(".main").empty().append(indexHtml());
$(".main>ul>li").click(function () {
$(".main").empty().append(indexHtml());
});
});


var html;
//获取index.html文件内容
var indexHtml = function () {
$.ajax({
url : "/static/html/index.html",
global : false,
type : "POST",
data : "{}",
dataType : "html",
async : false,
success : function (msg) {
html = msg;
}
});
return html;
}
*/
